package com.yan.gulimall.seckill.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@EnableAsync
@EnableScheduling
public class HelloSchedule {

    /**
     * 测试定时任务
     * 在spring中由6位组成
     * 定时任务通常应该是非阻塞的
     *      1、可以让业务已异步运行的方式,配置到线程池
     *      2、支持定时任务线程池-> 设置TaskScheduleProperties
     *      3、让spring-boot开启异步任务
     *
     */
    @Async
    @Scheduled(cron = "* * * * * *")
    public void hello(){
        log.info("hello....");
    }

}
